package com.example.user.controller;


import com.example.user.service.HiaeService;
import entity.Hiae;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;

/**
 * 家庭收支表(Hiae)表控制层
 *
 * @author makejava
 * @since 2022-03-31 17:03:57
 */
@RestController
@RequestMapping("hiae")
@Slf4j
@Api(value="家庭收支表接口",tags={"家庭收支表接口的controller"})
public class HiaeController  {
    /**
     * 服务对象
     */
    @Autowired
    private HiaeService hiaeService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    @ApiOperation(value="id查询收支",notes="id查询收支")
    public Hiae selectOne(@PathVariable Serializable id) {
        String zhu ="222";
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        log.info(request.getRequestURL().toString());
        return this.hiaeService.getById(id);
    }


}

